// app.js

const express = require('express')
const cors = require('cors')
const filesRouter = require('./routes/files')
const dataOverviewRouter = require('./routes/dataOverview')
const path = require('path')

const app = express()
const PORT = 8085

app.use(cors())
// 文件路由模块
app.use('/files', filesRouter)
// 静态资源目录
app.use('/images', express.static(path.join(__dirname, 'public')))

// 数据概览路由模块
app.use('/dataOverview', dataOverviewRouter)

app.get('/', (req, res) => {
  res.send('<h1>Hello Express</h1>')
})

app.listen(PORT, () => {
  console.log(`The server is running at http://localhost:${PORT}`)
})
